local skynet = require "skynet"
local log = require "sky_log"
local machine = {}
local game_process = require "game_process"


--创建
function machine:create_room(args)
    log.debug("machine:create_room ! args=", args)

    game_process:game_init(args)
end

--游戏开始
function machine:game_start(args)
    log.debug("machine:game_start ! args=", args)

    game_process:game_start(args)
end

--断线重连
function machine:reconnect_game(player_id)
    log.debug("machine:reconnect_game ! player_id=", player_id)

    game_process:reconnect_game(player_id)
end

--断线
function machine:disconnect(player_id)
    log.debug("machine:disconnect ! player_id=", player_id)

    game_process:disconnect(player_id)
end

--游戏开始
function machine:handle_msg(agent, msg_title, msg_data)
    log.debug("machine:handle_msg ! msg_title=", msg_title)
    log.debug("machine:handle_msg ! msg_data=", msg_data)

    game_process[msg_title](game_process, agent, msg_data)
end



return machine